//
//  ShopGoodCategaryViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/9.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "ShopGoodCategaryViewController.h"
#import "ClothsViewController.h"
#import "ShoeCapViewController.h"
#import "ShopCategaryMenu.h"
#import "BagViewController.h"
#import "NumeralViewController.h"
#import "FootViewController.h"
#import "DressViewController.h"
#import "BookViewController.h"
#import "HomeTextilesViewController.h"

@interface ShopGoodCategaryViewController ()

@property (nonatomic,strong) ShopCategaryMenu *selectMenu;

@end

@implementation ShopGoodCategaryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    //自定义tabBar跳转控制器
    [self.tabBar removeFromSuperview];
    
    self.selectMenu = [ShopCategaryMenu ShopCategaryWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width*0.3, [[UIScreen mainScreen] bounds].size.height)];
    [self.view addSubview:self.selectMenu];
    
    ClothsViewController *cloths = [[ClothsViewController alloc] initWithNibName:@"ClothsViewController" bundle:nil];
    [self addChildViewController:cloths];
    
    ShoeCapViewController *shoe = [[ShoeCapViewController alloc] initWithNibName:@"ShoeCapViewController" bundle:nil];
    [self addChildViewController:shoe];
    
    BagViewController *bag = [[BagViewController alloc] initWithNibName:@"BagViewController" bundle:nil];
    [self addChildViewController:bag];
    
    NumeralViewController *numeral = [[NumeralViewController alloc] initWithNibName:@"NumeralViewController" bundle:nil];
    [self addChildViewController:numeral];
    
    FootViewController *foot = [[FootViewController alloc] initWithNibName:@"FootViewController" bundle:nil];
    [self addChildViewController:foot];
    
    DressViewController *dress = [[DressViewController alloc] initWithNibName:@"DressViewController" bundle:nil];
    [self addChildViewController:dress];
    
    BookViewController *book = [[BookViewController alloc] initWithNibName:@"BookViewController" bundle:nil];
    [self addChildViewController:book];
    
    HomeTextilesViewController *homeTextiles = [[HomeTextilesViewController alloc] initWithNibName:@"HomeTextilesViewController" bundle:nil];
    [self addChildViewController:homeTextiles];
    
    [self.selectMenu.clothsBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.clothsBtn.tag = 1001;
    
    [self.selectMenu.shoeCapBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.shoeCapBtn.tag = 1002;
    
    [self.selectMenu.bagBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.bagBtn.tag = 1003;
    
    [self.selectMenu.numeralBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.numeralBtn.tag = 1004;
    
    [self.selectMenu.foodBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.foodBtn.tag = 1005;
    
    [self.selectMenu.dressBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.dressBtn.tag = 1006;
    
    [self.selectMenu.bookBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.bookBtn.tag = 1007;
    
    [self.selectMenu.homeTextilesBtn addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.selectMenu.homeTextilesBtn.tag = 1008;
}

- (void)clickTab:(UIButton *)sender {
    if (sender.tag == 1001) {
        [self setSelectedIndex:0];
    }else if(sender.tag == 1002)
    {
        [self setSelectedIndex:1];
    }else if (sender.tag == 1003)
    {
        [self setSelectedIndex:2];
    }else if (sender.tag == 1004)
    {
        [self setSelectedIndex:3];
    }else if (sender.tag == 1005)
    {
        [self setSelectedIndex:4];
    }else if (sender.tag == 1006)
    {
        [self setSelectedIndex:5];
    }else if (sender.tag == 1007)
    {
        [self setSelectedIndex:6];
    }else
    {
        [self setSelectedIndex:7];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
